
import Mock from 'mockjs'

const { prmgList } = Mock.mock({
    'prmgList|30': [
        {
            'name|1': ['蓉信世家', '远洋招商·上塘宸章', '新城北', '首开·望宸', '江宝龙城市广场', '绿城九仓·柳岸晓风', '金茂府', '龙湖·春江郦城', '北大资源·未名府', '融创金成·未来海', '祥生·群贤府', '都会艺境', '绿城·富春玫瑰园', '朗诗·熙华府', '融信·澜天', '越秀·亲爱里', '华策中心', '钱江彩虹府', '西房·拱宸外滩', '时间名座', '都城天漾·滨沁公寓', '融信保利·创世纪', '东海花园', '清泉苑公寓', '潞河名苑新城南街', '芙蓉花园', '梨园镇小街村住宅', '永顺西街住宅小区', '和谐家园', '建山帝都'],
            'img|1': ['https://img.axureshop.com/c9/57/1d/c9571de2aa7c47d2865ef6311a990b6a/images/%E6%B3%B5%E6%88%BF%E7%AE%A1%E7%90%86/u2206.png', 'https://img.axureshop.com/c9/57/1d/c9571de2aa7c47d2865ef6311a990b6a/images/%E6%B3%B5%E6%88%BF%E7%AE%A1%E7%90%86/u2204.png', 'https://img.axureshop.com/c9/57/1d/c9571de2aa7c47d2865ef6311a990b6a/images/%E6%B3%B5%E6%88%BF%E7%AE%A1%E7%90%86/u2205.png', 'https://img.axureshop.com/c9/57/1d/c9571de2aa7c47d2865ef6311a990b6a/images/%E6%B3%B5%E6%88%BF%E7%AE%A1%E7%90%86/u2207.png', 'https://img.axureshop.com/c9/57/1d/c9571de2aa7c47d2865ef6311a990b6a/images/%E6%B3%B5%E6%88%BF%E7%AE%A1%E7%90%86/u2182.png', 'https://img.axureshop.com/c9/57/1d/c9571de2aa7c47d2865ef6311a990b6a/images/%E6%B3%B5%E6%88%BF%E7%AE%A1%E7%90%86/u2182.png', 'https://img.axureshop.com/c9/57/1d/c9571de2aa7c47d2865ef6311a990b6a/images/%E6%B3%B5%E6%88%BF%E7%AE%A1%E7%90%86/u2182.png',],
            id: '@natural' + '@float',
            iS: false
        },
    ],
})


const { prmgList2 } = Mock.mock({
    'prmgList2': [
        {
            'ips': '@float(0, 2, 2, 2)',
            'ifs|1-50': 1,
            'current1': '@float(1, 10, 1, 1)',
            'current2': '@float(1, 10, 1, 1)',
            'current3': '@float(1, 10, 1, 1)',
            'ops': '@float(0, 2, 2, 2)',
            'frequency1': '@float(10, 50, 1, 1)',
            'frequency2': '@float(10, 50, 1, 1)',
            'frequency3': '@float(10, 50, 1, 1)',
            'eps': '@float(0, 2, 2, 2)',
            'sv|220-500': 220,
            'hips': '@float(0, 2, 2, 2)',
            'hifs|1-50': 1,
            'hcurrent1': '@float(1, 10, 1, 1)',
            'hcurrent2': '@float(1, 10, 1, 1)',
            'hcurrent3': '@float(1, 10, 1, 1)',
            'hops': '@float(0, 2, 2, 2)',
            'hfrequency1': '@float(10, 50, 1, 1)',
            'hfrequency2': '@float(10, 50, 1, 1)',
            'hfrequency3': '@float(10, 50, 1, 1)',
            'heps': '@float(0, 2, 2, 2)',
            'hsv|220-500': 220
        },
    ],
})

Mock.mock('/api/prmgList', 'post', (config?: any) => {

    return {
        code: 200,
        message: '获取数据成功',
        data: prmgList
    }
})
Mock.mock('/api/prmgList2', 'post', (config?: any) => {

    return {
        code: 200,
        message: '获取数据成功',
        data: prmgList2
    }
})

Mock.mock('/api/search', 'post', (data: any) => {
    // let req = config.body
    let arr = []
    console.log(data.body);
    for (let i = 0; i < prmgList.length; i++) {
        if (prmgList[i].name.indexOf(data.body) !== -1) {
            arr.push(prmgList[i])
        }
    }
    if (data.body == null) {
        arr = prmgList
    }
    return {
        code: 200,
        message: '搜索成功',
        data: arr
    }
})


